import { useState, useEffect } from "react";
import reactLogo from "./assets/react.svg";
import "./App.css";

import { Test } from "./Test";
import { Test2 } from "./Test2";
import * as aaa from './all.ts'
console.log(aaa.adduser6())
import { Button, message } from "antd";
import { Chart } from '@antv/g2';
function App() {
	const [count, setCount] = useState(0);

	useEffect(() => {
		console.log('useEffect parent更新')
		// 准备数据
		const data = [
			{ genre: 'Sports', sold: 275 },
			{ genre: 'Strategy', sold: 115 },
			{ genre: 'Action', sold: 120 },
			{ genre: 'Shooter', sold: 350 },
			{ genre: 'Other', sold: 150 },
		];

		// 初始化图表实例
		const chart = new Chart({ // new实例
			container: 'container',
		});

		// 声明可视化
		chart
			.interval() // 创建一个 Interval 标记
			.data(data) // 绑定数据
			.encode('x', 'genre') // 编码 x 通道
			.encode('y', 'sold'); // 编码 y 通道

		// 渲染可视化
		chart.render();
	})

	return (
		<div className="App">
			<div>
				<a href="https://reactjs.org" target="_blank" rel="noreferrer">
					<img src={reactLogo} className="logo react" alt="React logo" />
				</a>
			</div>
			<Test />
			<Test2 />
			<Button type="primary" onClick={() => message.success('操作成功')} >搜索</Button>
			<div id="container">1</div>
			<h1>Rspack + React + TypeScript</h1>
			<div className="card">
				<button type="button" onClick={() => setCount(count => count + 1)}>
					count is {count}
				</button>
				<p>
					Edit <code>src/App.tsx</code> and save to test HMR
				</p>
			</div>
			<p className="read-the-docs">
				Click on the Rspack and React logos to learn more
			</p>
		</div>
	);
}

export default App;
